<?php TPL::output('global/header.tpl.htm'); ?>

<div class="i_bd mainElem i_clear i_allbg">
<div class="i_left L_sidebar">
<form action="publish/ajax/<?php if ($this->question_info['question_id']) { ?>modify<?php } else { ?>publish<?php } ?>_question/" method="post" id="question_form" onsubmit="return false;">
<input type="hidden" name="post_hash" value="<?php echo new_post_hash(); ?>" />
<input type="hidden" name="attach_access_key" value="<?php echo $this->attach_access_key; ?>" />
<input type="hidden" name="question_id" id="question_id" value="<?php echo $this->question_info['question_id']; ?>" />
<input type="hidden" name="ask_user_id" value="<?php echo $_POST['ask_user_id']; ?>" />
<input type="hidden" name="question_cover_id" id= "question_cover_id" value="0" />
<?php if ($this->question_category_list) { ?>
<select name="category_id" class="i_hide" id="category_id">
	<option value="0">- 请选择分类 -</option>
	<?php echo $this->question_category_list; ?>
	</select>
<?php } ?>
<div class="b_restrain">
        <h4 class="i_gloCor latest_trendst_h3 q_content_h3"><b>发起站点</b></h4>
		
		<div class="a_question">
			<div style="width:466px;float:left;">
				<div class="a_qsAsk">
					<h4><strong>站点名：</strong></h4>
					<div class="a_qsAskQuestion i_prl">
					<div class="a_qsClassList i_pas" id="category_list" style ="z-index:30;">
						<span class="a_qsSelect  i_glotxtClass a_txtClass i_prl" id="category_container" onclick="$.Q.selectd({fg:this,listId:$('#i_data_list'),arrowsId:$('#a_arr'),selectId:$('#a_select'),category_id:$('#category_id')});"><big id="a_select" class="i_gltxtHide">选择分类</big><em title="选择分类" class="i_pas i_small" id="a_arr"></em></span>
						<div class="i_data_list i_pas" id="i_data_list">
							<em class="i_arrows"></em>
							<p class="i_list_p"><a href="javascript:;">请稍候...</a></p>
							
						</div>
					</div>
		             		  <input type="text"  name="question_content" id="question_contents" value="<?php echo $this->question_info['question_content']; ?>" onFocus="$.focus(this,'发起站点的标题...');" class=" a_txtClass question_title_txt i_glotxtClass"/>
					</div>
				</div>
				<div class = "a_qsAsk" style = "margin-top:10px;">
					<h4><strong>站点链接：</strong></h4>
					<div class="a_qsAskQuestion i_prl">
		               <input type="text"  name="question_url" id="question_url" style="width:410px;" value="<?php echo $this->question_info['question_url']; ?>" onFocus="$.focus(this,'发起站点的链接...');" class=" a_txtClass question_title_txt i_glotxtClass"/>
					</div>
			
				</div>
		</div>
		<div style="float:left;width:200px;height:124px;">
		<?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] ) { ?>
			<div style="width:60px;height:18px;">
			<span title="编辑" style="float:left;width:60px;visibility:visible;" class="q_editor i_small i_radiu3" id="question_pic_uploader">编辑图片</span>
			</div>
			<?php } ?>
			<span class="u_topicHead i_pas" style ="float:left;" >
				<img id="question_pic" style="margin-top:1px;width:180px;height:72px;" picId ="<?php echo $this->question_info['question_cover_id']; ?>" src="<?php echo $this->question_info['question_img_url']; ?>" title="<?php echo $this->question_info['question_content']; ?>"/>				
				<span id="uploading_status" style="display:none"><img src="<?php echo G_STATIC_URL; ?>/common/load.gif" align="absmiddle"></span>
			</span>		
			
		</div>
		<div class="a_qsAsk" style="float:left;">
			<h4 >站点描述（选填）：</h4>
			<div class="a_qsReplenish">
				<textarea name="question_detail" id="question_detail" class="i_glotxtClass i_txtHeight a_qstxt advanced_editor" onFocus="$.focus(this,'');"><?php echo $this->question_info['question_detail']; ?></textarea>
               
					<div class="i_acceMain">
						<div class="i_uploadMain" id="file_uploader_question">
							
						</div>
					</div>
				</div>
			</div>
			
			<?php if (!$this->question_info['question_id']) { ?>
			<div class="a_qsAsk"   style="float:left;>
			<h4 style="padding-bottom:0;">添加标签：<span class="q_topicMuster" id="i_PublicTopic">
				<?php if ($_GET['topic_title']) { ?>
				<a style="" data-value="sds" class="i_glotopic i_prl pd"><?php echo urldecode($_GET['topic_title']); ?><em title="删除" onclick="$.topic.deleted_topic(this,event,true); return false;" class="handle i_pas">×</em><input type="hidden" value="<?php echo urldecode($_GET['topic_title']); ?>" name="topics[]"></a>
				<?php } ?>
				
				<?php if ($_POST['topics']) { ?>
				<?php foreach ($_POST['topics'] AS $key => $val) { ?>
				<a style="" data-value="sds" class="i_glotopic i_prl pd"><?php echo $val; ?><em title="删除" onclick="$.topic.deleted_topic(this,event,true); return false;" class="handle i_pas">×</em><input type="hidden" value="<?php echo $val; ?>" name="topics[]"></a>
				<?php } ?>
				<?php } ?>
			</span>
				<span class="q_editor i_small" title="标签编辑" onClick="$.topic.editor_topic({flg:this,make:true});" id="editor_topicBtns" style="margin-bottom:5px;">标签编辑</span></h4>
			</div>
			<?php } ?>
		
			<?php if ($this->human_valid) { ?>
			<div class="a_qsAsk">
				<h4>验证码：</h4>
				<p><input type="text" name="seccode_verify" value="验证码" onFocus="$.focus(this,'验证码');" class="i_glotxtClass a_txtClass a_wcode"/> <img id="captcha" onclick="this.src = G_BASE_URL + '/account/captcha/rnd-' + Math.floor(Math.random() * 10000);" title="点击换一张" src=""></p>
			</div>
			<?php } ?>
 			 <?php TPL::output('global/opencheck.tpl.htm'); ?> 	<!--显示微博同步选项-->	              
			<div class="a_qsAsk i_tr" style=" padding-top:5px;">
				<?php if ($this->question_info['question_id'] AND ((!$this->question_info['lock'] AND ($this->question_info['published_uid'] == $this->user_id OR $this->user_info['permission']['edit_question'])) OR $this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'])) { ?>

				<span class="i_anonymity"><input type="checkbox" title="删除站点" name="do_delete" value="1" id="i_delete"><label for="i_delete">删除站点</label></span>
				<?php } ?>
				<?php if (!$this->question_info['question_id'] AND get_setting('anonymous_enable') == 'Y') { ?>
				<span class="i_anonymity"><input type="checkbox" title="匿名" name="anonymous" value="1" id="i_anonymity"><label for="i_anonymity">匿名</label></span>
				<?php } ?>
				<a class="i_replay_but2" href="javascript:;" title="确认发起" id="startQs_submite">确认发起</a>
			</div>
</div>		
</form>
</div>
</div>

<div class="R_sidebar">
	<div class="i_rightMain"> 
		<div class="interest_user">
			<h3>站点发起指南</h3>
			<div class="a_contxt">
			<p><b>● 站点标题：</b> 网站名称..例如 百度，谷歌，17find
			<!--  <?php if (get_setting('question_title_limit') > 0 ) { ?>
			，并控制在 <?php echo get_setting('question_title_limit'); ?> 个字数以内
			<?php } ?>。-->
			</p>
			<p><b>● 站点简介：</b> 一句话介绍，突出重点，画龙点睛</p>
			<p><b>● 选择标签：</b> 选择一个或者多个合适的标签，让您发布的站点得到更多有相同兴趣的人参与。所有人可以在您发布站点之后添加和编辑该站点所属的标签。</p>
            <?php if (get_setting('integral_system_enabled') == 'Y') { ?>
			<p><b>● 关于积分：</b> 发起一个站点会消耗您 <?php echo -get_setting('integral_system_config_new_question'); ?> 个积分，每多一个回复你将获得 <?php echo -get_setting('integral_system_config_new_answer'); ?> 个积分的奖励，为了您的利益，在发起站点的时候希望能够更好的描述您的站点以及多使用站内搜索功能</p>
            <?php } ?>
			</div>
		</div>
	</div>
</div>
</div>

<script type="text/javascript">
	var ATTACH_ACCESS_KEY = '<?php echo $this->attach_access_key; ?>';
	
	$(document).ready(function(e) {
        $('#category_id').length == 0 ? ($('#category_list').hide(),$('#category_list').parent().addClass('category_list')) :'';
		$('#category_id').val() > 0 ? $('#category_container').click() : '';
		$('#question_contents').changeElement($.searchEventQs);//站点搜索；
		
		// 上传站点logo图片  @author LSH 2013-01-02
		$('#question_pic_uploader').click(function()
				{
						var question_id = "<?php echo  ($this->question_info['question_id']) != null ?$this->question_info['question_id']:0 ?>";
						init_img_uploader(G_BASE_URL + '/question/ajax/upload_question_pic/questtion_id-' + question_id, 'question_pic', $('#question_pic_uploader'), $('#uploading_status'), $('#question_pic'));
						
				}			
		)
		$('#startQs_submite').click(function(){
			
			// URL 验证 author 2013-01-02
			 var strRegex = "^((https|http|ftp|rtsp|mms)://)?[a-z0-9A-Z]*\.[a-z0-9A-Z][a-z0-9A-Z]{0,61}?[a-z0-9A-Z]\.com|net|cn|cc|tv|info|fm|com.cn|us|me|hk|jp|org|(:s[0-9]{1-4})?/$";
	         var re = new RegExp(strRegex);
	         
	         
	         var picid=$('#question_pic').attr('picId')
	         $('#question_cover_id').val(picid);
	
			if($('#question_contents').val() == '发起站点的标题...' || $.trim($('#question_contents').val()).length == 0){
				$.alert('发起站点的标题不能为空,且大于 5 个字符...')
				return;
			}else if($.trim($('#question_contents').val()).length <1){
				$.alert('发起站点的标题不能少于 1 个字符...')
				return;
			 }else if($.trim($('#question_url').val()).length <1){
				$.alert('发起站点的链接太短了呢，亲...')
				return;
			}else if(!re.test($.trim($('#question_url').val()))){
				$.alert('这个是Url吗？...')  
				return;
			}else if($('#category_id').length > 0 && $('#category_id').val().length == 0){
				$.alert('请选择站点的分类...')
				return;
			}else{
				ajax_post($('#question_form'));
				
			}
		})
    });
</script>
<?php TPL::output('global/footer.tpl.htm'); ?>